<template>
	<svg class="svg-class"  :class='className'>
		<!-- vue2.0 link:href -->
		<use :href='iconName'></use>
	</svg>
</template>

<script>
	import './svg.js';
	
	export default {
		props:{
			name:{
				type:String,
				require:true
			},
			class:{
				type:String,
				default:''
			}
		},
		setup(props){
			// 没有响应式没必要ref()
			 const iconName = `#icon-${props.name}`
			 const className =props.class
			return {
				iconName,
				className
			}
		}
	}
</script>

<style lang='scss' scoped>
	.svg-class {
		width: 1em;
		height: 1em;
		fill:currentcolor;
	}
</style>
